﻿Public Class Generator

    Public MustInherit Class BaseCode
        <System.ComponentModel.Browsable(False)>
        MustOverride ReadOnly Property IsCode() As String
        Public Property Name As String
        Public Property [Shared] As Boolean = False
        Public Property ReadOnly_Static As Boolean = False
        Public Property Scope As Visibility_Scope = Visibility_Scope.Public

        Public Enum Visibility_Scope
            [Public]
            Protected_Friend
            [Friend]
            [Protected]
            [Private]
            [Dim]
        End Enum

        <System.ComponentModel.Editor(GetType(System.ComponentModel.Design.MultilineStringEditor), GetType(Drawing.Design.UITypeEditor))>
        Public Property GetCode() As String
            Get
                Return IsCode()
            End Get
            Set(ByVal value As String)
            End Set
        End Property


    End Class


    Public Class Generic_Class
        Inherits BaseCode
        '<System.ComponentModel.Editor(GetType(frmCodeUnit.Editor), GetType(Drawing.Design.UITypeEditor))>
        Public Property Constructor As New Code_Units.Constructor

        Public Property Properties As New List(Of Code_Units.Property)
        Public Property Methods As New List(Of Code_Units.Method)
        Public Property Fields As New List(Of Code_Units.Field)
        Public Property Attributes As New List(Of Code_Units.Field)

        <System.ComponentModel.Editor(GetType(frmCodeUnit.Editor), GetType(Drawing.Design.UITypeEditor))>
        Public Property IsProperty As New Code_Units.Property



        Sub New()

        End Sub

        Sub New(ByVal Name As String)
            Me.Name = Name
        End Sub


        <System.ComponentModel.Browsable(False)>
        Public Overrides ReadOnly Property IsCode As String
            Get
                Dim MyCode As String = Me.Scope.ToString.Replace("_", " ") & " Class " & Me.Name & vbCrLf
                MyCode += Me.Constructor.IsCode & vbCrLf & vbCrLf
                For Each Item In Me.Properties
                    MyCode += Item.IsCode & vbCrLf
                Next



                Return MyCode & vbCrLf & "End Class"
            End Get
        End Property

    End Class






End Class


Partial Class Generator
    Public Class Code_Units
        Private Sub New()
        End Sub

        ''' <summary>
        ''' 
        ''' </summary>
        ''' <remarks></remarks>
        Public MustInherit Class Code
            Inherits BaseCode
            Public Enum CodeType
                [Property]
                Method
                Field
                Constructor
                Attribute
            End Enum

            Public Property Data_Type As String = ""
            Dim _Type As CodeType
            Protected Friend ReadOnly Property Type As CodeType
                Get
                    Return _Type
                End Get
            End Property




            <System.ComponentModel.Browsable(False)>
            Public Overrides ReadOnly Property IsCode As String
                Get
                    Dim _Scope As String = Me.Scope.ToString.Replace("_", " ")

                    Select Case Me.Type
                        Case CodeType.Property
                            If CType(Me, [Property]).OneLine = True Then
                                Return String.Format("{0} {1} As {2}", _Scope, Me.Name, Me.Data_Type)
                            Else


                            End If

                    End Select
                End Get
            End Property



            Public Sub New(ByVal CodeType As CodeType)
                Me._Type = CodeType
            End Sub



        End Class

        Public Class [Property]
            Inherits Code
            Public Property OneLine As Boolean = True
            Sub New()
                MyBase.New(CodeType.Property)
            End Sub

        End Class

        Public Class Method
            Inherits Code
            Sub New()
                MyBase.New(CodeType.Method)
            End Sub

        End Class

        Public Class Constructor
            Inherits Code
            Sub New()
                MyBase.New(CodeType.Constructor)
            End Sub

        End Class

        Public Class Field
            Inherits Code
            Sub New()
                MyBase.New(CodeType.Field)
            End Sub

        End Class

        Public Class Attribute
            Inherits Code
            Sub New()
                MyBase.New(CodeType.Attribute)
            End Sub

        End Class



    End Class
End Class